package cn.edu.xmu.orderpayment.order.model.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Yujie Lin
 * @date 2021/12/10 10:08
 */
public enum DocumentType {
    ORDER(0,"订单"),
DEPOSIT(1,"保证金"),
ADVANCEPRICE(2,"定金"),
RESTPRICE(3,"尾款");


    private static final Map<Integer, DocumentType> DOCUMENT_TYPE_MAP;

    static {
        DOCUMENT_TYPE_MAP = new HashMap();
        for (DocumentType enum1 : values()) {
            DOCUMENT_TYPE_MAP.put(enum1.code, enum1);
        }
    }

    private int code;
    private String description;

    DocumentType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static DocumentType getTypeByCode(Integer code) {
        return DOCUMENT_TYPE_MAP.get(code);
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
